Skip to content

Remove curl dependency from crates-io crate#16936

Merged
weihanglo merged 5 commits intorust-lang:masterfrom
arlosi:async/easy
Apr 28, 2026
Merged

Remove curl dependency from crates-io crate#16936
weihanglo merged 5 commits intorust-lang:masterfrom
arlosi:async/easy

Conversation

@arlosi
Copy link
Copy Markdown
Contributor

@arlosi arlosi commented Apr 23, 2026

What does this PR try to resolve?

Converts the crates-io crate to be HTTP Client agnostic. It now uses a trait to execute HTTP requests. This enables users of the library to use any HTTP library they like, rather than only supporting curl.

Within cargo, an HttpClient using http_async is added (which uses curl internally).

cc #16845

How to test and review this PR?

Commit by commit. Could be tested on on live crates.io, but I have not done this.

@rustbot rustbot added A-interacts-with-crates.io Area: interaction with registries A-networking Area: networking issues, curl, etc. Command-publish S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 23, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 23, 2026

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

@arlosi arlosi changed the title Async/easy Remove curl dependency from crates-io crate Apr 23, 2026
@arlosi arlosi mentioned this pull request Apr 23, 2026
6 tasks
Comment thread crates/crates-io/lib.rs
@arlosi arlosi force-pushed the async/easy branch 2 times, most recently from 9c0e0d7 to 54ea404 Compare April 23, 2026 19:54
@arlosi
Copy link
Copy Markdown
Contributor Author

arlosi commented Apr 23, 2026

This is a breaking change for the crates-io crate which removes curl and requires users to provide their own HTTP client implementation using curl or another http request library.

@rfcbot fcp merge cargo

@arlosi

This comment was marked as outdated.

1 similar comment
@weihanglo

This comment was marked as outdated.

@weihanglo weihanglo added the T-cargo Team: Cargo label Apr 24, 2026
@weihanglo
Copy link
Copy Markdown
Member

weihanglo commented Apr 24, 2026

See #16936 (comment).

@rfcbot fcp merge cargo

@rust-rfcbot
Copy link
Copy Markdown
Collaborator

rust-rfcbot commented Apr 24, 2026

Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Apr 24, 2026

[dependencies]
curl.workspace = true
http.workspace = true
Copy link
Copy Markdown
Member

@weihanglo weihanglo Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we enhance docs talking about how to restore the curl backend behavior?

If it is not worthy, leave it :)

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm kinda split about that. I have a branch that adds a curl feature to provide a CurlClient that implements the trait and gives users a way back to the old behavior. However, since Cargo wouldn't be enabling the feature, it would have less coverage.

Copy link
Copy Markdown
Member

@0xPoe 0xPoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread crates/crates-io/lib.rs Outdated
@rustbot

This comment has been minimized.

Copy link
Copy Markdown
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

View changes since this review

@ehuss ehuss moved this to FCP merge in Cargo status tracker Apr 28, 2026
@rust-rfcbot rust-rfcbot added final-comment-period FCP — a period for last comments before action is taken and removed proposed-final-comment-period An FCP proposal has started, but not yet signed off. labels Apr 28, 2026
@rust-rfcbot
Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

The request_blocking method does not use the `Client`-level
timeout management, since it blocks, running the request
on the current thread. This leaves the request_blocking
method with no timeout configured.

The change adds the timeout for consistency with the `http::http_handle`
method.
arlosi added 4 commits April 28, 2026 10:51
This is needed since in our testing framework we use
file:// URLs. With upload(true), the test files are overwritten as empty
before they are read. This leads to the yank tests failing.

In a real (non-file://) registry api, this would have no impact.
This is a breaking change in the crates-io crate.

It removes the dependency on curl. Users using this crate will need
to provide their own implementation of the HttpClient trait using
curl or another http request library.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 28, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@weihanglo
Copy link
Copy Markdown
Member

I don't think this require 10-day full FCP as it is a major version release not a breaking change in Cargo itself. Let's merge it right now.

@weihanglo weihanglo added this pull request to the merge queue Apr 28, 2026
Merged via the queue into rust-lang:master with commit bbc9162 Apr 28, 2026
31 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-interacts-with-crates.io Area: interaction with registries A-networking Area: networking issues, curl, etc. Command-publish disposition-merge FCP with intent to merge final-comment-period FCP — a period for last comments before action is taken T-cargo Team: Cargo

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants